package com.shanjupay.merchant.convert;

import com.shanjupay.merchant.api.dto.MerchantDTO;
import com.shanjupay.merchant.vo.MerchantRegisterVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @author whb
 * @create 2021-11-24 16:40
 * @desciption vo和dto之间的转换类（MapStruct工程提供的功能）
 */
@Mapper //对象属性的映射
public interface MerchantRegisterConvert {
    //转换类实例
    MerchantRegisterConvert INSTANCT= Mappers.getMapper(MerchantRegisterConvert.class);

    /**
     * 将vo转成dto
     * @param merchantRegisterVO
     * @return
     */
    MerchantDTO vo2dto(MerchantRegisterVO merchantRegisterVO);

    /**
     * 将dto转成vo
     * @param merchantDTO
     * @return
     */
    MerchantRegisterVO dto2vo(MerchantDTO merchantDTO);

    /**
     * 接口内部main方法
     * @param args
     */
    public static void main(String[] args) {
        MerchantRegisterVO merchantRegisterVO=new MerchantRegisterVO();
        merchantRegisterVO.setMobile("13333333332");
        merchantRegisterVO.setMerchantName("蜜雪冰城");
        merchantRegisterVO.setPassword("123456");
        merchantRegisterVO.setVerifiykey("sms:1881adedf56e4ceb94e855329ee75c9b");
        merchantRegisterVO.setVerifiyCode("384923");

        MerchantDTO merchantDTO = MerchantRegisterConvert.INSTANCT.vo2dto(merchantRegisterVO);
        System.out.println(merchantDTO);
    }
}
